/*
 * 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙，邂逅框架梦]
 * 
 * 知启蒙Servlet兼容库（zhiqim_servlet）在LGPL3.0协议下开源：https://www.zhiqim.com/gitcan/zhiqim/zhiqim_servlet.htm
 *
 * This file is part of [zhiqim_servlet].
 * 
 * [zhiqim_servlet] is free software: you can redistribute
 * it and/or modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * [zhiqim_servlet] is distributed in the hope that it will
 * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with [zhiqim_servlet].
 * If not, see <http://www.gnu.org/licenses/>.
 */
package org.zhiqim.calendar.model;

import org.zhiqim.kernel.util.Strings;

/**
 * 日历星期模型，根据休息日划分出的星期模型
 *
 * @version v1.0.0 @author zouzhigang 2017-11-8 新建与整理
 */
public class CalendarWeekModel
{
    private int beginDate;
    private int beginYear;
    private int beginMonth;
    private int beginDay;
    
    private int endDate;
    private int endYear;
    private int endMonth;
    private int endDay;

    public CalendarWeekModel(int beginDate)
    {
        this.beginDate = beginDate;

        this.beginYear = beginDate / 10000;
        this.beginMonth = beginDate / 100 % 100;
        this.beginDay = beginDate % 10000;
    }
    
    public void setEndDate(int endDate)
    {
        this.endDate = endDate;
        
        this.endYear = endDate / 10000;
        this.endMonth = endDate / 100 % 100;
        this.endDay = endDate % 10000;
    }
    
    public int getBeginDate()
    {
        return beginDate;
    }

    public int getEndDate()
    {
        return endDate;
    }
    
    public int getBeginYear()
    {
        return beginYear;
    }

    public int getBeginMonth()
    {
        return beginMonth;
    }

    public int getBeginDay()
    {
        return beginDay;
    }

    public int getEndYear()
    {
        return endYear;
    }

    public int getEndMonth()
    {
        return endMonth;
    }

    public int getEndDay()
    {
        return endDay;
    }

    public String getWeekBegin()
    {
        return beginYear + "-" + Strings.prefixZero(beginMonth, 2) + "-" + Strings.prefixZero(beginDay, 2);
    }
    
    public String getWeekEnd()
    {
        return endYear + "-" + Strings.prefixZero(endMonth, 2) + "-" + Strings.prefixZero(endDay, 2);
    }
}
